<?php
require_once 'BaseController.php';

/**
 * 【SP版】トップページ コントローラ
 */
class Mobileapi_TopController extends Mobileapi_BaseController
{

    /**
     * メインアクション
     */
    public function indexAction()
    {
        $params = $this->getParameters();

        // エリアコード名
        $this->_data['area_code_name_hokkaido'] = Apm_Config_Common::AREA_CODE_NAME_HOKKAIDO;
        $this->_data['area_code_name_tohoku'] = Apm_Config_Common::AREA_CODE_NAME_TOHOKU;
        $this->_data['area_code_name_kanto'] = Apm_Config_Common::AREA_CODE_NAME_KANTO;
        $this->_data['area_code_name_koshinetsu_hokuriku'] = Apm_Config_Common::AREA_CODE_NAME_KOSHINETSU_HOKURIKU;
        $this->_data['area_code_name_tokai'] = Apm_Config_Common::AREA_CODE_NAME_TOKAI;
        $this->_data['area_code_name_kansai'] = Apm_Config_Common::AREA_CODE_NAME_KANSAI;
        $this->_data['area_code_name_chugoku_shikoku'] = Apm_Config_Common::AREA_CODE_NAME_CHUGOKU_SHIKOKU;
        $this->_data['area_code_name_kyushu_okinawa'] = Apm_Config_Common::AREA_CODE_NAME_KYUSHU_OKINAWA;

        switch ($params['Category'])
        {
            case Apm_Config_Common::AREA_CODE_NAME_TOHOKU:
                $tpl = "tohoku";
                break;
            case Apm_Config_Common::AREA_CODE_NAME_KANTO:
                $tpl = "kanto";
                break;
            case Apm_Config_Common::AREA_CODE_NAME_TOKAI:
                $tpl = "tokai";
                break;
            case Apm_Config_Common::AREA_CODE_NAME_KANSAI:
                $tpl = "kansai";
                break;
            case Apm_Config_Common::AREA_CODE_NAME_CHUGOKU_SHIKOKU:
                $tpl = 'chugoku';
                break;
            case Apm_Config_Common::AREA_CODE_NAME_KOSHINETSU_HOKURIKU:
                $tpl = 'hokuriku';
                break;
            case Apm_Config_Common::AREA_CODE_NAME_KYUSHU_OKINAWA:
                $tpl = 'kyushu';
                break;
            default:
                $tpl = 'top';
                break;
        }
        // 全国の物件数取得
        $this->_data['zenkokucnt'] = number_format(Apm_Util::getZenkokuCount());
        // エリア毎のテンプレートを設定
        $this->_data['tab_contents'] = $this->getApmHelper($tpl)->getBlock();

        $this->displayBody($tpl, 'topbar1');
    }

}
?>
